<%@ page contentType="text/html; charset=UTF-8"

         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <base href="<%=basePath%>">
    <!-- jsp文件头和头部 -->
    <%@ include file="../../system/admin/top.jsp" %>
</head>
<body>

<div class="container-fluid" id="main-container">

    <div id="page-content" class="clearfix">

        <div class="row-fluid">

            <div class="row-fluid">

                <!-- 检索  -->
                <form action="bill/list.do" method="post" name="Form" id="Form">
                    <table>
                        <tr>
                            <!--
                            <%--<c:if test="${QX.cha == 1 }">--%>
                                <td style="vertical-align:top;"><a
                                        class="btn btn-mini btn-light" onclick="toExcel();"
                                        title="导出EXCEL"><i id="nav-search-icon"
                                                            class="icon-download-alt"></i>
                                </a>
                                </td>
                            <%--</c:if>--%>
                            -->
                        </tr>
                    </table>
                    <!-- 检索  -->


                    <table id="table_report"
                           class="table table-striped table-bordered table-hover">

                        <thead>
                        <tr>
                            <th class="center"><label><input type="checkbox"
                                                             id="zcheckbox"/><span class="lbl"></span>
                            </label></th>
                            <th class="center">序号</th>
                            <th class="center">号段起始</th>
                            <th class="center">号段结束</th>
                            <th class="center">有效卡数</th>
                            <th class="center">当月收费卡数</th>
                            <th class="center">总金额</th>
                            <th class="center">状态</th>
                            <th class="center">用户套餐</th>
                            <th class="center">按年价格</th>
                        </tr>
                        </thead>

                        <tbody>

                        <!-- 开始循环 -->
                        <c:choose>
                            <c:when test="${not empty varList}">
                                <c:forEach items="${varList}" var="var" varStatus="vs">
                                    <tr>
                                        <td class='center' style="width: 30px;"><label><input
                                                type='checkbox' name='ids' value="${var.id}"/><span
                                                class="lbl"></span>
                                        </label></td>
                                        <td class='center' style="width: 30px;">${vs.index+1}</td>
                                        <td>${var.start}</td>
                                        <td>${var.end}</td>
                                        <td>${var.activeNum}</td>
                                        <td>${var.billCardNum}</td>
                                        <td>${var.totalFee}</td>
                                        <td>${var.statusStr}</td>
                                        <td>${var.pkgStr}</td>
                                        <td>${var.userPrice}</td>
                                    </tr>

                                </c:forEach>
                                <c:if test="${QX.cha == 0 }">
                                    <tr>
                                        <td colspan="9" class="center">您无权查看</td>
                                    </tr>
                                </c:if>
                            </c:when>
                            <c:otherwise>
                                <tr class="main_info">
                                    <td colspan="9" class="center">没有相关数据</td>
                                </tr>
                            </c:otherwise>
                        </c:choose>


                        </tbody>
                    </table>

                </form>
            </div>


            <!-- PAGE CONTENT ENDS HERE -->
        </div>
        <!--/row-->

    </div>
    <!--/#page-content-->
</div>
<!--/.fluid-container#main-container-->

<!-- 返回顶部  -->
<a href="#" id="btn-scroll-up" class="btn btn-small btn-inverse"> <i
        class="icon-double-angle-up icon-only"></i> </a>

<!-- 引入 -->
<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
<script src="static/js/bootstrap.min.js"></script>
<script src="static/js/ace-elements.min.js"></script>
<script src="static/js/ace.min.js"></script>

<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script>
<!-- 下拉框 -->
<script type="text/javascript"
        src="static/js/bootstrap-datepicker.min.js"></script>
<!-- 日期框 -->
<script type="text/javascript" src="static/js/bootbox.min.js"></script>
<!-- 确认窗口 -->
<!-- 引入 -->
<script type="text/javascript" src="static/js/jquery.tips.js"></script>
<!--提示框-->
<script type="text/javascript">

    $(top.hangge());

    //检索
    function search() {
        top.jzts();
        $("#Form").submit();
    }

</script>

<script type="text/javascript">

    $(function () {

        //下拉框
        $(".chzn-select").chosen();
        $(".chzn-select-deselect").chosen({allow_single_deselect: true});

        //日期框
        $('.date-picker').datepicker();

        //复选框
        $('table th input:checkbox').on('click', function () {
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function () {
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });

        });

    });


    //批量操作
    function makeAll(msg) {
        bootbox.confirm(msg, function (result) {
            if (result) {
                var str = '';
                for (var i = 0; i < document.getElementsByName('ids').length; i++) {
                    if (document.getElementsByName('ids')[i].checked) {
                        if (str == '') str += document.getElementsByName('ids')[i].value;
                        else str += ',' + document.getElementsByName('ids')[i].value;
                    }
                }
                if (str == '') {
                    bootbox.dialog("您没有选择任何内容!",
                        [
                            {
                                "label": "关闭",
                                "class": "btn-small btn-success",
                                "callback": function () {
                                    //Example.show("great success");
                                }
                            }
                        ]
                    );

                    $("#zcheckbox").tips({
                        side: 3,
                        msg: '点这里全选',
                        bg: '#AE81FF',
                        time: 8
                    });

                    return;
                } else {
                    if (msg == '确定要删除选中的数据吗?') {
                        top.jzts();
                        $.ajax({
                            type: "POST",
                            url: '<%=basePath%>bill/deleteAll.do?tm=' + new Date().getTime(),
                            data: {DATA_IDS: str},
                            dataType: 'json',
                            //beforeSend: validateData,
                            cache: false,
                            success: function (data) {
                                $.each(data.list, function (i, list) {
                                    nextPage(${page.currentPage});
                                });
                            }
                        });
                    }
                }
            }
        });
    }

    //导出excel
    function toExcel() {
        window.location.href = '<%=basePath%>bill/excel.do';
    }
</script>

</body>
</html>

